@echo off

set "jmx_template=iInterface"
set "suffix=.jmx"
set "jmx_template_filename=%jmx_template%%suffix%"
set num=10

echo Start auto stress test.
:auto

set "jmx_filename=%jmx_template%_%num%%suffix%"
set "jtl_filename=test_%num%.jtl"
set "web_report_path_name=web_%num%"

del %jmx_filename% %jtl_filename%
rd /s /q %web_report_path_name%

COPY %jmx_template_filename% %jmx_filename%
echo Generate jmx file %jmx_filename%


sed -i "s/thread_num/%num%/g" %jmx_filename%


call %jmeter_path%/bin/jmeter -n -t %jmx_filename% -l %jtl_filename%

call %jmeter_path%/bin/jmeter -g %jtl_filename% -e -o %web_report_path_name%

del %jmx_filename% %jtl_filename%

set /a num=num+10
if %num% LEQ 30 goto auto

echo End of the auto stress test